package ejb;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import jpa.Puntate;
import jpa.Utente;

/**
 *
 * @author frazz
 */
@Stateless
public class GestorePuntata {

    @PersistenceContext
    private EntityManager em;

    public void inserisciPuntata(Utente u, int d) {
        Puntate p = new Puntate(d);
        String idUt = u.getUsername();
        p.setCliente(idUt);
        em.persist(p);
        //il flush rende effettive le modifiche immediatamente
        em.flush();
    }
}
